<template>
  <div>
    <h2>App</h2>
    <p>{{ count }}</p>
    <Child @add="addCount" ></Child>
    <Child ref="myChild"></Child>
  </div>
</template>

<script>
import Child from './Child.vue'
export default {
  name: 'App',
  data() {
    return {
      count: 0,
    }
  },
  mounted() {
      console.log(this)
      this.$refs.myChild.$on('addCount',this.addCount)
  },
  methods: {
    addCount() {
      this.count++
    },
  },
  components: {
    Child,
  },
}
</script>

<style></style>
